<form action="index.php?ctl=trading/deliveryarea&act=updateOrderNum" id="catEditor" method="post" target="{update:'messagebox'}">
<!--<div class="action-bar mainHead"><span class="sysiconBtn addorder" onclick="W.page('index.php?ctl=goods/category&act=addNew')"><{t}>添加分类<{/t}></span></div> -->

<div class="action-bar mainHead"><a href="index.php?ctl=trading/deliveryarea&act=showNewArea" class="sysiconBtn addorder"><{t}>添加顶级地区<{/t}></a></div>
<table cellspacing="0" cellpadding="0" class="gridlist">
<col class="Colauto"></col>
<col class="Coloption_1b"></col>
<col class="Coloption_1b" ></col>
<col class="Coloption_1b"></col>
<col class="Coloption_1b"></col>
<col></col>
<thead>
<th><{t}>地区名称<{/t}></th>
<th><{t}>排序<{/t}></th>
<th><{t}>添加子地区<{/t}></th>
<th><{t}>编辑<{/t}></th>
<th><{t}>删除<{/t}></th>
<th></th>
</thead>
<tbody>
<{foreach from=$area item=item key=iLoop name="item"}>
<tr parentid="<{$item.region_id}>">
  <td style="text-align:left; width:320px; overflow:hidden;">
<div style="padding-left:<{$item.step*25}>px">
     <{if $item.child_count>0}>
         <img class="imgTree" onclick="clickTree(this)" id=<{$item.region_id}> src="images/sitemapclosed.gif" />
     <{else}>
         <img id=<{$item.region_id}> src="images/sitemapopened.gif" />
     <{/if}>
     
    <a style="font-weight:700; color:#000; text-decoration:none;padding-right:15px;" href='index.php?ctl=trading/deliveryarea&act=detailDlArea&p[0]=<{$item.region_id}>'><{$item.local_name}></a></div>
    </th>
<td style="width:80px"><input  class="_x_ipt" vtype="unsignedint" type="number" size="2" style="width:30px;"  name="p_order[<{$item.region_id}>]" value="<{$item.ordernum}>" caution="请输入正整数"></td>
  <td style="width:100px;"><{assign var="region_id" value=$item.region_id}>
    <a href='index.php?ctl=trading/deliveryarea&act=showNewArea&p[0]=<{$region_id}>'><{img src="images/bundle/addcate.gif" border="0" alt="添加子地区"}></a>
    </td>
    <td style="width:60px;"><a class="i" href='index.php?ctl=trading/deliveryarea&act=detailDlArea&p[0]=<{$item.region_id}>'><{img src="images/bundle/editcate.gif" border="0" alt="编辑"}></a></td>
    <td style="width:60px;"><span onclick="javascript: if(confirm('您确定要删除&nbsp;[<{$item.local_name}>]&nbsp;？')){ W.page('index.php?ctl=trading/deliveryarea&act=toRemoveArea&p[0]=<{$item.region_id}>',{method:'get'});}" style="cursor:pointer"><{img src="images/bundle/delecate.gif" border="0" alt="删除"}></span></Td>
<td></td>
</tr>
<{/foreach}>
</tbody
></table>
  <div class="mainFoot">
    <div class="footer">
 <div class="table-action">
	<{button type="submit" label="保存" onclick="$('catEditor').fireEvent('submit',{stop:function(){}})"}>
</div>

    </div>
  </div>
</form>
<img id=imgTreeC style="display:none" src="images/sitemapclosed.gif" />
<img id=imgTreeO style="display:none" src="images/sitemapopened.gif" />
<script>
function clickTree(ipt){
  var obj = $(ipt).getParent('[parentid]');
  if($(ipt).src == $('imgTreeC').src && (!obj.getNext() || !obj.getNext().get('readstatus'))){
    new Element('tr',{'readstatus':1}).adopt(new Element('td').setProperties({'colspan':'6','style':'border:none'}).setStyle('padding',0)).injectAfter(obj);
    
    W.page('index.php?ctl=trading/deliveryarea&act=getChildNode',{update:obj.nextSibling.firstChild,method:'post',data:'regionId='+$(ipt).id});
  }else{
      if($(ipt).src == $('imgTreeC').src){
        obj.getNext().style.display = '';
      }else{
        obj.getNext().style.display = 'none';
      }
  }

  if($(ipt).src == $('imgTreeC').src) $(ipt).src = $('imgTreeO').src;
  else $(ipt).src = $('imgTreeC').src;
}
</script>